package com.dinzeer.slashblade_useful_addon.config;

import com.dinzeer.slashblade_useful_addon.Slashblade_useful_addon;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.config.ModConfigEvent;

// An example config class. This is not required, but it's a good idea to have one to keep your config organized.
// Demonstrates how to use Forge's config APIs
@Mod.EventBusSubscriber(modid = Slashblade_useful_addon.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class Config
{
    private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();

    private static final ForgeConfigSpec.BooleanValue ENABLE_SOUL_TRAPEZOID = BUILDER
            .comment("耀魂喷泉模块开关")
            .define("enableSoulTrapezoid", true);

    private static final ForgeConfigSpec.BooleanValue ENABLE_NETHER_STAR_UPGRADE = BUILDER
            .comment("下界之星增强面板模块开关")
            .define("enableNetherStarUpgrade", true);

    private static final ForgeConfigSpec.IntValue SOUL_COST = BUILDER
            .comment("耀魂喷泉门槛")
            .defineInRange("soulCost", 1000, 100, 10000);

    private static final ForgeConfigSpec.IntValue MAX_ATTACK_MODIFIER = BUILDER
            .comment("下界之星增加刀面板(需要填充时比期望面板少1)")
            .defineInRange("maxAttackModifier", 40, 10, 100);
    private static final ForgeConfigSpec.BooleanValue ENABLE_DO_SLASH = BUILDER
            .comment("拔刀触发幻影剑技")
            .define("enableDoSlash", true);

    private static final ForgeConfigSpec.BooleanValue ENABLESS = BUILDER
            .comment("SS后攻击变三段")
            .define("enabless", false);

    private static final ForgeConfigSpec.BooleanValue DISABLE_STUN = BUILDER
            .comment("快刀无感模块")
            .define("disable_stun", true);
    private static final ForgeConfigSpec.BooleanValue XPAdd = BUILDER
            .comment("经验值增伤")
            .define("xp_add", false);
    public static final ForgeConfigSpec.BooleanValue disableOtherInteractions = BUILDER
            .comment("是否开启持刀无法交互除刀以外的所有的可交互选项功能")
            .define("disableOtherInteractions", true);
    private static final ForgeConfigSpec.DoubleValue REFINED_FACTOR = BUILDER
            .comment("幻影剑倍率模块精炼等级加成系数")
            .defineInRange("refinedFactor", 0.05, 0.0,  Double.MAX_VALUE);

    private static final ForgeConfigSpec.DoubleValue ATTACK_MODIFIER_FACTOR = BUILDER
            .comment("幻影剑倍率模块基础攻击修正系数")
            .defineInRange("attackModifierFactor", 0.1, 0.0, Double.MAX_VALUE);
    public static final ForgeConfigSpec.DoubleValue ATTACK_MODIFIER_FACTOR_ForSlashEffect = BUILDER
            .comment("刀光倍率模块基础攻击修正系数")
            .defineInRange("attackModifierFactor_slash_effect", 1, 0, Double.MAX_VALUE);

    public static final ForgeConfigSpec.BooleanValue DAMAGE_RANDOM = BUILDER
            .comment("伤害浮动化")
            .define("damage_random", false);



    public static final ForgeConfigSpec.BooleanValue VXV = BUILDER
            .comment("瞬步扣血开关")
            .define("let_go", false);
    public static final ForgeConfigSpec.BooleanValue VXV_SST = BUILDER
            .comment("瞬步扣血开启后是否是sst模式，需开启瞬步扣血后才生效")
            .define("let_go_sst", false);






    public static final ForgeConfigSpec SPEC = BUILDER.build();




    // 新增静态字段
    public static boolean enableDoSlash;
    public static boolean enableSoulTrapezoid;
    public static boolean enableNetherStarUpgrade;
    public static int soulCost;
    public static int maxAttackModifier;

    public static Boolean enabless;
    public static Boolean ds;
    public static Boolean xpadd;

    public static double refinedFactor;
    public static double attackModifierFactor;

    @SubscribeEvent
    static void onLoad(final ModConfigEvent event)
    {
        enableDoSlash = ENABLE_DO_SLASH.get();
        enableSoulTrapezoid = ENABLE_SOUL_TRAPEZOID.get();
        enableNetherStarUpgrade = ENABLE_NETHER_STAR_UPGRADE.get();
        soulCost = SOUL_COST.get();
        maxAttackModifier = MAX_ATTACK_MODIFIER.get();
        enabless = ENABLESS.get();
        ds=DISABLE_STUN.get();
        xpadd=XPAdd.get();
        refinedFactor=REFINED_FACTOR.get();
        attackModifierFactor=ATTACK_MODIFIER_FACTOR.get();
    }
}
